<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="{$_C.hy_path}css/amazeui.min.css" />
		<link rel="stylesheet" type="text/css" href="{$_C.hy_path}css/hy.admin.css" />
	</head>

	<body>
		{include file='../Common/hy_header.html'}
		<div class="am-g">
			<div class="am-tabs am-margin" data-am-tabs="">
				<ul class="am-tabs-nav am-nav am-nav-tabs">
					<!-- <li class="am-active"><a hidefocus="true" href="#tab1">基本详情</a>
					</li>
					<li class="" ><a hidefocus="true" href="#tab3">SEO 选项</a>
					</li> -->
				</ul>

				<div class="am-tabs-bd am-form" style="touch-action: pan-y; -webkit-user-select: none; -webkit-user-drag: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);">

					<div class="am-tab-panel am-fade am-active am-in" id="tab1">
						
						<div class="am-g am-margin-top">
							<div class="am-u-sm-2 am-text-right">
								奖品名称
							</div>
							<div class="am-u-sm-4 am-u-end">
								<input type="text" id="prize_name" value="{$res.prize_name}" class="am-input-sm">
							</div>
						</div>

						<div class="am-g am-margin-top">
							<div class="am-u-sm-2 am-text-right">
								赞助商
							</div>
							<div class="am-u-sm-4 am-u-end">
								<input type="text" id="support" value="{$res.support}" class="am-input-sm">
							</div>
						</div>
						
						<div class="am-g am-margin-top">
							<div class="am-u-sm-2 am-text-right">
								价格
							</div>
							<div class="am-u-sm-4 am-u-end">
								<input type="text" id="money" value="{$res.money}" placeholder="" class="am-input-sm">
							</div>
						</div>
						
						<div class="am-g am-margin-top">
							<div class="am-u-sm-2 am-text-right">
								备注
							</div>
							<div class="am-u-sm-4 am-u-end">
								<input type="text" id="mark" value="{$res.mark}" placeholder="奖品介绍" class="am-input-sm">
							</div>
						</div>
						
						<div class="am-g am-margin-top">
							<div class="am-u-sm-2 am-text-right">
								中奖概率
							</div>
							<div class="am-u-sm-4 am-u-end">
								<input type="text" id="pby" value="{$res.pby}" placeholder="输入1~100以内的整数" class="am-input-sm">
							</div>
						</div>
						
						<div class="am-g am-margin-top">
							<div class="am-u-sm-2 am-text-right">
								中奖优先级
							</div>
							<div class="am-u-sm-4 am-u-end">
								<input type="text" id="pri" value="{$res.pri}" placeholder="请输入正整数" class="am-input-sm">
							</div>
						</div>

						<div class="am-g am-margin-top">
							<div class="am-u-sm-2 am-text-right">
								卡券ID
							</div>
							<div class="am-u-sm-4 am-u-end">
								<input type="text" id="card_id" value="{$res.card_id}" placeholder="" class="am-input-sm">
							</div>
						</div>
								<input type="hidden" id="shd" value="{$res.id}" placeholder="" >
						
						<div class="am-margin" style="margin-left:25%;">
							<button type="button" onclick="submit()" class="am-btn am-btn-primary am-btn-xs">提交保存</button>
						</div>

					
				</div>
				
			</div>
		</div>
		<div class="hy-footer">

		</div>
		{include file='../Common/hy_footer.html'}
		<script type="text/javascript" src="{$_C.hy_path}js/editor/kindeditor.js"></script>
		<script type="text/javascript">
			function submit()
			{
				if($("#prize_name").val()=='')
				{
					showMsg('奖品名称不能为空',1);
					return;
				}
				if($("#support").val()=='')
				{
					showMsg('赞助商不能为空',1);
					return;
				}
				if($("#money").val()=='')
				{
					showMsg('价格不能为空',1);
					return;
				}
				if($("#pby").val()=='')
				{
					showMsg('中奖概率不能为空',1);
					return;
				}
				
				if($("#pri").val()=='')
				{
					showMsg('中奖优先级不能为空',1);
					return;
				}
				if($("#card_id").val()=='')
				{
					showMsg('卡券id不能为空',1);
					return;
				}
				
				$.ajax({
					type:"POST",
					url:"index.php?g=admin&m=car&a=set_prize",
					data:{
						id:$("#shd").val(),
						prize_name:$("#prize_name").val(),
						support:$("#support").val(),
						money:$("#money").val(),
						mark:$("#mark").val(),
						pby:$("#pby").val(),
						pri:$("#pri").val(),
						card_id:$("#card_id").val()
					},
					dataType:"json",
					success:function(data){
						if(data.error == 1){
							showMsg(data.content,1);
						}
						else{
							showMsg(data.content,0);
						}
					},
					error:function(){
						
					}
				});
			}
		</script>
	</body>

</html>